1. Field of the Invention
The present invention relates to a microcomputer having a ROM emulation function used for debugging software.
2. Description of the Prior Art
Referring now to FIG. 10, there is illustrated a diagram showing a concept underlying a prior art microcomputer as disclosed in, for example, "Mitsubishi 32-bit RISC single-chip microcomputer M32R family M32R/E series 32160 group M32160F3UFP M32160F4UFP User Manual", pp.5-37 to 5-39, Mitsubishi Electric Corp. and Mitsubishi Semiconductor System Corp., Aug. 20, 1998. In the figure, reference numeral 1 denotes a read-only-memory or ROM, 2 denotes a random-access-memory or RAM, 11 denotes each of a plurality of ROM areas into which the ROM 1 is divided, each ROM area having a predetermined size, e.g., 8Kbytes as shown in the figure, and 21 denotes a first RAM area in the RAM 2 having a predetermined size, e.g., 8Kbytes as shown in the figure, which is the same as that of each ROM area 11. Each ROM area 11 includes a starting address specifying the memory location of its top, such as address A, B, or the like as shown in FIG. 10.
In operation, when changing the current mode into ROM simulation mode, the starting address specifying the ROM area 11 that is to be replaced with the first RAM area 21, for example, the address A is set, and "1" is written into an emulation mode bit of a control register not shown. When the emulation mode bit is set to "1", the ROM area 11 whose starting address has been specified, in this case, whose starting address is the address A, can be replaced with the first 8KB RAM area 21. Therefore, when the ROM area 11 whose address has been selected in the ROM emulation mode, in this case, is the address A, is accessed by something, the first RAM area 21 on the RAM 2 is actually accessed.
When performing an emulation operation on another ROM area 11, for example, the next ROM area 11 whose starting address is the address B, the same process is carried out by setting another address specifying the memory location of the top of the other ROM area, for example, the address B. The ROM area 11 whose starting address has been specified, for example, whose starting address is the address B, is replaced with the first 8KB RAM area 21. Therefore, when the ROM area 11 whose address has been specified in the ROM emulation mode is accessed by something, for example, when the ROM area 11 with the starting address B is accessed by something, the first RAM area 21 in the RAM 2 is actually accessed. In this manner, an application that needs to change data while it is running can dynamically change the data using the first RAM area 21 on the RAM 2.
Japanese Patent Application publications (KOKAI) No. 62-251934, No. 64-84341, No. 7-302254, and No. 6-139102 disclose a prior art technique that relates to a microcomputer having such a ROM emulation function, for example.
A problem with such a prior art microcomputer so constructed as mentioned above is that since one of the plurality of ROM area 11 in the ROM 1 is securely replaced with a predetermined RAM area 21 in the RAM 2 in the emulation 30 mode, the memory map of part of the RAM in which the program that is debugged and tuned in the emulation mode is stored differs from that of corresponding part of the ROM in which the program is actually stored, and therefore, the whole of the program needs to be reconfigured (or rewritten) after the tuning is complete.